/*
 * Print.hpp
 *
 *  Created on: Nov 23, 2012
 *      Author: dan
 */

#ifndef PRINT_HPP_
#define PRINT_HPP_

#include <boost/thread.hpp>
struct DebugPrint{
	bool print;
	DebugPrint(bool p=false):print(p){}
	inline void turn_on(){print=true;}
	inline void turn_off(){print=false;}
};
inline boost::mutex& print_mtx(){ static boost::mutex m; return m; }
#define PRINT(X) if(debug_print.print)do{boost::mutex::scoped_lock l(print_mtx()); std::cout<<X<<std::endl; }while(0)
inline void print(std::string message){DebugPrint debug_print(true); PRINT(message);}
#define STR std::string("")



#endif /* PRINT_HPP_ */
